package cz.najman.emdroid.mappings;

import java.util.HashMap;

import android.net.Uri;
import android.provider.BaseColumns;
import cz.najman.emdroid.provider.EMDroidDataProvider;
import cz.najman.emdroid.provider.Flags;

public class RegistrationState extends Mappings implements BaseColumns, Flags {
	
	public static final String URI_STRING_REGISTRATION_STATES = "content://" + EMDroidDataProvider.AUTHORITY + "/registrationStates";
	public static final String URI_STRING_REGISTRATION_STATES_FOR_EVENT = "content://" + EMDroidDataProvider.AUTHORITY + "/registrationStates/forEvent";
	public static final String URI_STRING_REGISTRATION_STATES_FOR_USER = "content://" + EMDroidDataProvider.AUTHORITY + "/registrationStates/forUser";

	public static final Uri CONTENT_URI_REGISTRATION_STATES = Uri.parse(URI_STRING_REGISTRATION_STATES);
	public static final Uri CONTENT_URI_REGISTRATION_STATES_FOR_EVENT = Uri.parse(URI_STRING_REGISTRATION_STATES_FOR_EVENT);
	public static final Uri CONTENT_URI_REGISTRATION_STATES_FOR_USER = Uri.parse(URI_STRING_REGISTRATION_STATES_FOR_USER);
	
	/**
	 * Content type dir
	 */
	public static final String CONTENT_TYPE_DIR = "vnd.android.cursor.dir/vnd.mitch.registrationState";
	/**
	 * Content type item
	 */
	public static final String CONTENT_TYPE_ITEM = "vnd.android.cursor.item/vnd.mitch.registrationState";

	public static final int OBJECT_ID = 4;

	/* DATABASE COLUMNS NAMES */
	
	/**
	 * Unique id for the RegistrationState
	 */
	//public static final String _ID = "reg_state_id";

	public static final String TABLE_NAME = "registration_states";

	public static final String REGISTRATION_DATE = "registration_date";

	public static final String STATE = "state";

	public static final String PAYMENT_DATE = "payment_date";

	public static final String PAYMENT_VALUE = "payment_value";

	public static final String STORNO_VALUE = "storno_value";

	public static final String USER_ID = "user_id";

	public static final String EVENT_ID = "event_id";

	public static final String COMMENT = "comment";

	public static final String STORNO_REASON = "storno_reason";

	/* DATABASE COLUMS INDEXES */

	public static final int INDEX_ID = 0;

	public static final int INDEX_REGISTARTION_DATE = 1;

	public static final int INDEX_STATE = 2;

	public static final int INDEX_PAYMENT_DATE = 3;

	public static final int INDEX_PAYMENT_VALUE = 4;

	public static final int INDEX_STORNO_VALUE = 5;

	public static final int INDEX_USER_ID = 6;

	public static final int INDEX_EVENT_ID = 7;

	public static final int INDEX_COMMENT = 8;

	public static final int INDEX_STORNO_REASON = 9;
	
	public static final int INDEX_STATE_FLAG = 10;	
	
	/* MAPPING KEYS */	
	public static String ROOT_TAG = "registrationStates";
	private static final String M_KEY_START_TAG = "registrationState";
	private static final String M_KEY_ID = "id";
	private static final String M_KEY_REGISTARTION_DATE = "registrationDate";
	private static final String M_KEY_STATE = "status";
	private static final String M_KEY_PAYMENT_DATE = "paymentDate";
	private static final String M_KEY_PAYMENT_VALUE = "paymentValue";
	private static final String M_KEY_STORNO_VALUE = "stornoValue";
	private static final String M_KEY_USER_ID = "userId";
	private static final String M_KEY_EVENT_ID = "eventId";
	private static final String M_KEY_COMMENT = "comment";
	private static final String M_KEY_STORNO_REASON = "stornoReason";
			
	public RegistrationState() {
		mToDbMappings = new HashMap<String, String>();
		mFromDbMappings = new HashMap<String, String>();
		
		mFromDbMappings.put(START_TAG, M_KEY_START_TAG);
		mFromDbMappings.put(_ID, M_KEY_ID);
		mFromDbMappings.put(REGISTRATION_DATE, M_KEY_REGISTARTION_DATE);
		mFromDbMappings.put(STATE, M_KEY_STATE);
		mFromDbMappings.put(PAYMENT_DATE, M_KEY_PAYMENT_DATE);
		mFromDbMappings.put(PAYMENT_VALUE, M_KEY_PAYMENT_VALUE);
		mFromDbMappings.put(STORNO_VALUE, M_KEY_STORNO_VALUE);
		mFromDbMappings.put(STORNO_REASON, M_KEY_STORNO_REASON);
		mFromDbMappings.put(USER_ID, M_KEY_USER_ID);
		mFromDbMappings.put(EVENT_ID, M_KEY_EVENT_ID);
		mFromDbMappings.put(COMMENT, M_KEY_COMMENT);
		
		mToDbMappings.put(M_KEY_START_TAG, START_TAG);
		mToDbMappings.put(M_KEY_ID, _ID);
		mToDbMappings.put(M_KEY_REGISTARTION_DATE, REGISTRATION_DATE);
		mToDbMappings.put(M_KEY_STATE, STATE);
		mToDbMappings.put(M_KEY_PAYMENT_DATE, PAYMENT_DATE);
		mToDbMappings.put(M_KEY_PAYMENT_VALUE, PAYMENT_VALUE);
		mToDbMappings.put(M_KEY_STORNO_VALUE, STORNO_VALUE);
		mToDbMappings.put(M_KEY_STORNO_REASON, STORNO_REASON);
		mToDbMappings.put(M_KEY_USER_ID, USER_ID);
		mToDbMappings.put(M_KEY_EVENT_ID, EVENT_ID);
		mToDbMappings.put(M_KEY_COMMENT, COMMENT);		
		
		mDates.add(PAYMENT_DATE);
		mDates.add(REGISTRATION_DATE);
	}
	
}
